package com.uuj.dome.controller;

import com.alibaba.fastjson.JSONObject;
import com.uuj.dome.utils.LoggerUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * ClassName:controller
 * PACKAGE_NAME:com.uuj.dome.controller
 */
@RestController
@RequestMapping(value = "/index")
public class IndexController {


    @GetMapping("/login")
    public JSONObject login(HttpServletRequest request,String name) {
        JSONObject jsonObject = new JSONObject();

        jsonObject.put("msg", "用户"+name+"登录成功");
        // 返回值写到请求体重
        request.setAttribute(LoggerUtil.LOGGER_RETURN,jsonObject);
        return jsonObject;
    }
}
